/**
 * Title:       PlatformServiceDescriptor.java
 * Copyright:   Copyright (c) 1996-2004 The Agent Factory Working Group. All rights reserved.
 * Licence:     This file is free software; you can redistribute it and/or modify
 *              it under the terms of the GNU Lesser General Public License as published by
 *              the Free Software Foundation; either version 2.1, or (at your option)
 *              any later version.
 *
 *              This file is distributed in the hope that it will be useful,
 *              but WITHOUT ANY WARRANTY; without even the implied warranty of
 *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *              GNU Lesser General Public License for more details.
 *
 *              You should have received a copy of the GNU Lesser General Public License
 *              along with Agent Factory; see the file COPYING.  If not, write to
 *              the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 *              Boston, MA 02111-1307, USA.
 */
package com.agentfactory.platform.service;

import java.util.ArrayList;
import java.util.StringTokenizer;
/**
 * This class contains a description of the message transport service to
 * be added to the agent platform.  This description combines a class
 * name (the implementation) and a collection of arguments (the configuration).
 *
 * @author  Rem Collier
 */
public class PlatformServiceDescriptor {
    private String name;
    private int priority;
    private String className;
    private ArrayList arguments;
    
    /** Creates a new instance of MessageTransportDescriptor */
    public PlatformServiceDescriptor(StringTokenizer tok) {
        name = tok.nextToken();
        if (name.equals("PRIORITY")) {
            priority = Integer.parseInt(tok.nextToken());
            name = tok.nextToken();
        }
        className = tok.nextToken();
        
        arguments = new ArrayList();
        while (tok.hasMoreTokens()) {
            arguments.add(tok.nextToken());
        }
    }
    
    public int getPriority() {
        return priority;
    }
    
    public String getName() {
        return name;
    }
    
    public String getClassName() {
        return className;
    }
    
    public String getArgument(int arg) {
        return (String) arguments.get(arg);
    }
    
    public int numberArguments() {
        return arguments.size();
    }
}
